﻿<%@ WebHandler Language="C#" Class="exit" %>

using System;
using System.Web;
using OneshoppingWeb;
using OneShoppingUtility;
using System.Web.SessionState;

public class exit : IHttpHandler, IRequiresSessionState
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        try
        {
            String LoginName = context.Session["user"].ToString();
            if (LoginName == "" || LoginName == null)
            {
                context.Response.Write(UtilityJson.ResultToJson((int)Protocol_user.NOT_LOG));//您没有登入
            }
            else {
                context.Session.Clear();
                context.Response.Write(UtilityJson.ResultToJson((int)Protocol_user.ALREADY_EXIT));//退出成功
            }
        }
        catch
        {
            context.Response.Write(UtilityJson.ResultToJson((int)Protocol_user.NOT_LOG));//您没有登入
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}